/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface CoreKhda extends BasicModel<CoreKhda> {
  khdaDwbm?: string; // 单位编码
  khdaDwjc?: string; // 单位简称
  khdaDwqc?: string; // 单位全称
  khdaDwfl?: string; // 单位分类
  khdaYwy?: string; // 业务员
  khdaDwdz?: string; // 单位地址
  khdaJsfs?: string; // 结算方式
  khdaJszq?: string; // 结算周期
  khdaSxed?: string; // 授信额度
}

export const coreKhdaList = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/list', params });

export const coreKhdaListData = (params?: CoreKhda | any) =>
  defHttp.post<Page<CoreKhda>>({ url: adminPath + '/bas/cus/coreKhda/listData', params });

export const coreKhdaForm = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/form', params });

export const coreKhdaSave = (params?: any, data?: CoreKhda | any) =>
  defHttp.postJson<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/save', params, data });

export const coreKhdaImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/cus/coreKhda/importData',
      onUploadProgress,
    },
    params,
  );

export const coreKhdaDisable = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/disable', params });

export const coreKhdaEnable = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/enable', params });

export const coreKhdaDelete = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/delete', params });

export const coreKhdaTreeData = (params?: CoreKhda | any) =>
  defHttp.get<CoreKhda>({ url: adminPath + '/bas/cus/coreKhda/treeData', params });
